atsi: Fix emission of text selection changes
authorMatthias Clasen <mclasen@redhat.com>
Wed, 21 Oct 2020 01:31:23 +0000 (21:31 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 21 Oct 2020 01:31:23 +0000 (21:31 -0400)
We were not emitting text-selection-changed and
text-caret-moved as expected.

gtk/a11y/gtkatspicontext.c

index a72a6ad40eed95ce375c28693832b71210d196a4..b030d1cfd76f8c7aa709a04a2224d54512b2d165 100644 (file)
@@ -729,14 +729,24 @@ emit_text_selection_changed (GtkAtSpiContext *self,
                              const char      *kind,
                              int              cursor_position)
 {
-  g_dbus_connection_emit_signal (self->connection,
-                                 NULL,
-                                 self->context_path,
-                                 "org.a11y.atspi.Event.Object",
-                                 "TextChanged",
-                                 g_variant_new ("(siiva{sv})",
-                                                kind, cursor_position, 0, g_variant_new_string (""), NULL),
+  if (strcmp (kind, "text-caret-moved") == 0)
+    g_dbus_connection_emit_signal (self->connection,
+                                   NULL,
+                                   self->context_path,
+                                   "org.a11y.atspi.Event.Object",
+                                   "TextCaretMoved",
+                                   g_variant_new ("(siiva{sv})",
+                                                  "", cursor_position, 0, g_variant_new_string (""), NULL),
                                  NULL);
+  else
+    g_dbus_connection_emit_signal (self->connection,
+                                   NULL,
+                                   self->context_path,
+                                   "org.a11y.atspi.Event.Object",
+                                   "TextSelectionChanged",
+                                   g_variant_new ("(siiva{sv})",
+                                                  "", 0, 0, g_variant_new_string (""), NULL),
+                                   NULL);
 }
 
 static void